/** ***************************************************************************
 * CoffeeLogger.hpp
 * 2012 CoffeeParty Ltd.
 * Date Created: 2012-07-21                                  format YYYY-MM-DD
 * Revision Id: $Id$
 ******************************************************************************
 */

#ifndef _COFFEE_LOGGER_HPP_
#define _COFFEE_LOGGER_HPP_

#include "CoffeeCommons.hpp"
#include "CoffeeTypes.hpp"
#include <stdarg.h>

inline void c_print(c_const_bytep format, ...)
{
    c_byte msg[0xFF];
    va_list ap;

    va_start(ap, format);
    vsprintf(msg, format, ap);
    va_end(ap);

    fprintf(stdout, "[PRN] %s\n", msg);
}

inline void c_print(c_uint size, c_const_bytep format, ...)
{
    c_bytep msg = (c_bytep)malloc(size * sizeof(c_byte) + 1);
    va_list ap;

    va_start(ap, format);
    vsprintf(msg, format, ap);
    va_end(ap);

    fprintf(stdout, "[PRN] %s\n", msg);
    free(msg);
}

inline void c_print_noeol(c_const_bytep format, ...)
{
    c_byte msg[0xFF];
    va_list ap;

    va_start(ap, format);
    vsprintf(msg, format, ap);
    va_end(ap);

    fprintf(stdout, "[PRN] %s", msg);
}

inline void c_print_noeol(c_uint size, c_const_bytep format, ...)
{
    c_bytep msg = (c_bytep)malloc(size * sizeof(c_byte) + 1);
    va_list ap;

    va_start(ap, format);
    vsprintf(msg, format, ap);
    va_end(ap);

    fprintf(stdout, "[PRN] %s", msg);
    free(msg);
}

#endif /** _COFFEE_LOGGER_HPP_ */
